package com.qdu.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import com.qdu.controller.WebSocket;
import com.qdu.service.SocketService;
import com.qdu.service.impl.SocketServiceImpl;

@Configuration

public class WebSocketConfig {//spring boot +webSocket会对每一个客户端创建一个WebSocketServer，所以直接在WebSocket中注入会被直接忽略

	@Bean
	public ServerEndpointExporter serverEndpointExporter() {
		return new ServerEndpointExporter();
	}
	@Autowired
	public void setMessageService(SocketService service) {
		 WebSocket.service = service;
	 }
	
}
